<template>
  <div class="guide">
    <Header />
    <div class="page-header">
      <h1>汉中旅游指南</h1>
      <p>为您的汉中之行提供详细实用的出行信息</p>
    </div>
    <div class="guide-container">
      <!-- 优化后的按钮式导航栏 -->
      <div class="guide-nav">
        <router-link
          v-for="(item, index) in guideTabs"
          :key="index"
          :to="item.path"
          :class="{ 'active': currentTab === item.name }"
          class="nav-button"
        >
          {{ item.label }}
        </router-link>
      </div>
      
      <el-main>
        <router-view />
      </el-main>
    </div>
  </div>
</template>

<script>
import Header from '@/components/Header.vue'

export default {
  name: 'Guide',
  components: { Header },
  data() {
    return {
      guideTabs: [
        { name: 'traffic', path: '/guide/traffic', label: '交通指南' },
        { name: 'accommodation', path: '/guide/accommodation', label: '住宿推荐' },
        { name: 'tips', path: '/guide/tips', label: '注意事项' }
      ]
    }
  },
  computed: {
    currentTab() {
      return this.$route.name;
    }
  }
}
</script>

<style scoped>
.guide {
  padding-top: 100px;
  background-color: #f9fafc;
}
.page-header {
  max-width: 1200px;
  margin: 0 auto 30px;
  text-align: center;
  padding: 20px 0;
}
.page-header h1 {
  font-size: 28px;
  color: #303133;
  margin-bottom: 10px;
  font-weight: 600;
}
.page-header p {
  font-size: 16px;
  color: #606266;
  margin: 0;
}
.guide-container {
  max-width: 1200px;
  margin: 0 auto;
  padding: 0 20px 40px;
  background-color: #fff;
  border-radius: 8px;
  box-shadow: 0 2px 12px rgba(0, 0, 0, 0.05);
}
.guide-nav {
  display: flex;
  justify-content: center;
  margin-bottom: 30px;
  gap: 15px;
}
.nav-button {
  padding: 12px 24px;
  background-color: #f0f2f5;
  color: #606266;
  border-radius: 20px;
  font-size: 16px;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.3s ease;
  text-align: center;
  display: flex;
  align-items: center;
  justify-content: center;
  min-width: 120px;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.08);
  text-decoration: none; /* 确保无下划线 */
}
.nav-button:hover {
  background-color: #e4e7ed;
  transform: translateY(-2px);
  box-shadow: 0 2px 5px rgba(0, 0, 0, 0.1);
}
.nav-button.active {
  background-color: #409EFF;
  color: #fff;
  box-shadow: 0 2px 6px rgba(64, 158, 255, 0.4);
}
/* 确保router-link无默认样式 */
a {
  text-decoration: none;
}
</style>